-
Notifications
You must be signed in to change notification settings - Fork 45
adding missing endpoints for tv shows #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
adding topRated, onTheAir and airingToday
final adding topRated, onTheAir a airingToday
TVSeasonBasic
TVSeasonBasic
debugPrint
add decoder
find by external sources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds missing endpoints for TV shows and introduces a new Find service for searching TMDb content using external IDs (IMDB, Facebook, etc.). The changes include three new TV series list endpoints (top rated, on the air, airing today), a refactored season model to support basic season information, and comprehensive Find service infrastructure.
Key changes:
- Added three new TV series list endpoints: topRated, onTheAir, and airingToday
- Introduced FindService with support for external ID lookups across multiple platforms
- Refactored TVSeries model to use TVSeasonBasic instead of TVSeason for better separation of concerns
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/TMDbTests/TestUtils/Tags.swift | Added test tag for find service |
| Tests/TMDbTests/Domain/Services/Find/TMDbFindServiceTest.swift | Basic test setup for find service |
| Sources/TMDb/TMDBClient.swift | Integrated FindService into main client |
| Sources/TMDb/Networking/TMDbAPIClient.swift | Added debug logging for API responses |
| Sources/TMDb/Domain/Services/TVSeries/TVSeriesService.swift | Added protocol methods for three new TV series endpoints |
| Sources/TMDb/Domain/Services/TVSeries/TMDbTVSeriesService.swift | Implemented three new TV series list methods |
| Sources/TMDb/Domain/Services/TVSeries/Requests/TopRatedTVSeriesRequest.swift | Request implementation for top rated TV series |
| Sources/TMDb/Domain/Services/TVSeries/Requests/OnTheAirTVSeriesRequest.swift | Request implementation for on the air TV series |
| Sources/TMDb/Domain/Services/TVSeries/Requests/AiringTodayTVSeriesRequest.swift | Request implementation for airing today TV series |
| Sources/TMDb/Domain/Services/Find/TMDbFindService.swift | Core find service implementation |
| Sources/TMDb/Domain/Services/Find/Request/FindRequest.swift | API request for find by external ID |
| Sources/TMDb/Domain/Services/Find/FindService.swift | Protocol definition for find service |
| Sources/TMDb/Domain/Models/TVSeries.swift | Changed seasons property to use TVSeasonBasic |
| Sources/TMDb/Domain/Models/TVSeasonBasic.swift | New basic season model without episode details |
| Sources/TMDb/Domain/Models/FindServiceType.swift | Enum of supported external ID sources |
| Sources/TMDb/Domain/Models/FindResponse.swift | Response models for find API results |
| Sources/TMDb/Domain/APIClient/APIRequestQueryItem.swift | Added external_source query parameter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| final class AiringTodayTVSeriesRequest: DecodableAPIRequest<TVSeriesPageableList> { | ||
|
|
||
| init(page: Int? = nil, language: String? = nil) { | ||
| let path = "/tv/popular" |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API path is incorrect for airing today endpoint. It should be '/tv/airing_today' instead of '/tv/popular'.
| let path = "/tv/popular" | |
| let path = "/tv/airing_today" |
| do { | ||
| debugPrint("Data \(String(describing: String(data: data, encoding: .utf8)))") |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug print statement should be removed before merging to production. Consider using a proper logging framework or conditional compilation for debug builds.
| do { | |
| debugPrint("Data \(String(describing: String(data: data, encoding: .utf8)))") | |
| do { | |
| #if DEBUG | |
| debugPrint("Data \(String(describing: String(data: data, encoding: .utf8)))") | |
| #endif |
| } | ||
|
|
||
| @Test("find by external id") | ||
| func movieGenresWithDefaultParameterValuesReturnsGenres() async throws { |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test function name 'movieGenresWithDefaultParameterValuesReturnsGenres' doesn't match the test purpose which is to test finding by external ID.
| func movieGenresWithDefaultParameterValuesReturnsGenres() async throws { | |
| func findByExternalIdReturnsExpectedResult() async throws { |
| let result = try await (service as FindService).findId("tt11952708", | ||
| type: .imdbID) | ||
|
|
||
| print(result) |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test should include assertions instead of just printing the result. Add proper validation to verify the expected behavior.
| print(result) | |
| // Validate the result is not nil and matches expected structure | |
| #expect(result != nil, "Result should not be nil") | |
| // Optionally, add more specific assertions if you know the expected result | |
| // For example, if result is a FindResult type: | |
| // #expect(result.movies.count > 0, "Should find at least one movie") |
| /// https://api.themoviedb.org/3/find/tt11952708?external_source=imdb_id' | ||
| /// | ||
|
|
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment contains an example URL but lacks context. Either remove this or properly document it as an example with explanation of the API endpoint.
| /// https://api.themoviedb.org/3/find/tt11952708?external_source=imdb_id' | |
| /// | |
| /// Example API endpoint: | |
| /// https://api.themoviedb.org/3/find/tt11952708?external_source=imdb_id | |
| /// | |
| /// This endpoint allows you to search for content on TMDb using an external ID. | |
| /// - `tt11952708` is an example external ID (in this case, an IMDb ID). | |
| /// - `external_source=imdb_id` specifies the type of external ID being used. | |
| /// The `findId(_:type:)` function wraps this endpoint, allowing you to search for TMDb content by providing an external ID and its type. |
| let overview: String | ||
| let posterPath: String? | ||
|
|
||
| // Pre filmy |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment appears to be in a non-English language. Should be 'For movies' instead of 'Pre filmy'.
| // Pre filmy | |
| // For movies |
| let releaseDate: String? | ||
| let video: Bool? | ||
|
|
||
| // Pre seriály |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment appears to be in a non-English language. Should be 'For TV series' instead of 'Pre seriály'.
| // Pre seriály | |
| // For TV series |
| /// TODO: | ||
|
|
||
| enum CodingKeys: String, CodingKey { | ||
| case id |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete TODO comment. The TVSeasonResult struct is not fully implemented - either complete the implementation or add a descriptive TODO explaining what needs to be done.
| /// TODO: | |
| enum CodingKeys: String, CodingKey { | |
| case id | |
| let airDate: String? | |
| let episodeCount: Int? | |
| let name: String? | |
| let overview: String? | |
| let posterPath: String? | |
| let seasonNumber: Int? | |
| let showId: Int? | |
| let voteAverage: Double? | |
| enum CodingKeys: String, CodingKey { | |
| case id | |
| case airDate = "air_date" | |
| case episodeCount = "episode_count" | |
| case name | |
| case overview | |
| case posterPath = "poster_path" | |
| case seasonNumber = "season_number" | |
| case showId = "show_id" | |
| case voteAverage = "vote_average" |
No description provided.